package com.example.demo.servicemanage.controller;

import com.example.demo.servicemanage.service.ServiceService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@Transactional
@CrossOrigin
public class ServiceController {

    private Logger log = Logger.getLogger(ServiceController.class);

    @Autowired
    private ServiceService serviceService;

    /**
         * @Description 新增维修记录
         * @Author zhangxue
         * @Date 11:18 2018/7/12
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/saveService",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> saveService(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = serviceService.saveService(param);
        return statusMap;
    }

    /**
     * @Description 编辑加油记录
     * @Author zhangxue
     * @Date 11:18 2018/7/12
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/editService",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> editService(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = serviceService.editService(param);
        return statusMap;
    }

    /**
     * @Description 删除维修记录
     * @Author zhangxue
     * @Date 11:18 2018/7/12
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/delService",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> delRefuel(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = serviceService.delService(param);
        return statusMap;
    }

    /**
         * @Description 查询所有维修记录
         * @Author zhangxue
         * @Date 10:59 2018/11/13
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/queryAllService",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> queryAllRefuel(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = serviceService.queryAllService(param);
        return statusMap;
    }

}
